package com.neomanager.admin.dao;

import java.util.ArrayList;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class AdminDao extends SqlMapClientDaoSupport
{
	public Logger logger = Logger.getLogger(this.getClass());

	/**
	 * 관리자 목록
	 */
	public ArrayList<Map<String, Object>> selectAdminInfo(Map<String, Object> param) throws DataAccessException
	{
		logger.info("관리자목록 DAO");
		@SuppressWarnings("unchecked")
		ArrayList<Map<String, Object>> rslist = (ArrayList<Map<String, Object>>) getSqlMapClientTemplate().queryForList("admin.selectAdminInfo", param);
        return rslist;
	}

	/**
	 * 관리자 상세
	 */
	public Map<String, Object> selectAdminInfoById(Map<String, Object> param) throws DataAccessException
	{
		logger.info("관리자상세 DAO");
		@SuppressWarnings("unchecked")
		Map<String, Object> rs = (Map<String, Object>) getSqlMapClientTemplate().queryForObject("admin.selectAdminInfoById", param);
        return rs;
	}
	
	/**
	 * 관리자 등록
	 */
	public void insertAdminInfo(Map<String, Object> param) throws DataAccessException
	{
		logger.info("관리자 등록 DAO");
		getSqlMapClientTemplate().insert("admin.insertAdminInfo", param);
        return;
	}

	/**
	 * 관리자 수정
	 */	
	public void updateAdminInfo(Map<String, Object> param) throws DataAccessException {
		logger.info("관리자 수정 DAO");
		getSqlMapClientTemplate().update("admin.updateAdminInfo", param);
        return;
	}

	/**
	 * 관리자 삭제
	 */	
	public void deleteAdminInfo(Map<String, Object> param) throws DataAccessException {
		logger.info("관리자 삭제 DAO");
		getSqlMapClientTemplate().update("admin.deleteAdminInfo", param);
        return;
	}	
	
}
